﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Extend.Pool
{
    public class PoolContainer
    {
        /*
         池物体的默认父节点
             */

        public static readonly Transform Transform;

        static PoolContainer()
        {
            GameObject root = GameObject.Find("/GameObjPool");
            Transform rootTrans;
            if (root == null)
            {
                root = new GameObject("GameObjPool");
                rootTrans = root.transform;

                GameObject container = new GameObject("Container");
                container.transform.SetParent(rootTrans, false);
                container.SetActive(false);
                Transform = container.transform;
            }
            else
            {
                rootTrans = root.transform;
                Transform = rootTrans.Find("Container");
            }

            GameObject.DontDestroyOnLoad(root);
        }
    }

}

